﻿namespace incubation_xna3d.Screens
{
    interface IScreenManager 
    {
        IScreen Current { get; }
        void GoTo(IScreen screen);
    }

    class ScreenManager : IScreenManager
    {
        #region IScreenManager
        private IScreen _current;
        public IScreen Current 
        { 
            get { return _current; }
            private set 
            {
                if(_current != null) _current.Leave();
                
                _current = value;
                
                if(_current != null) _current.Enter();
            } 
        }

        public void GoTo(IScreen screen) 
        {
            Current = screen;
        }
        #endregion
    }
}
